# -*- coding: utf-8 -*-
from db.mysql import MysqlClient
from common.helper import Helper
from itertools import product
class Arrangement( object ):
    def __init__(self):
        self.mysql = MysqlClient()
        self.name = "营运交通工具乘客意外险"
    # 生产产品数据
    def pullData(self, data={}):
        prices = ["15.00","21.00","32.00"]
        plan = {
            "planA":{
                "airplane_death":["2000000"],
                "train_death":["1000000"],
                "ship_disability":["1000000"],
                "passenger_death":["200000"],
                "plan":["黄金版"]
            },
            "planB": {
                "airplane_death": ["2000000"],
                "train_death": ["1000000"],
                "ship_disability": ["1000000"],
                "passenger_death": ["300000"],
                "plan": ["白金版"]
            },
            "planC": {
                "airplane_death": ["5000000"],
                "train_death": ["2000000"],
                "ship_disability": ["2000000"],
                "passenger_death": ["300000"],
                "plan": ["钻石版"]
            }

        }
        num=0
        for k in plan:
            for v in product(plan[k]["airplane_death"],plan[k]["train_death"],plan[k]["ship_disability"],plan[k]["passenger_death"],plan[k]["plan"]):
                data = {
                    "name":self.name,
                    "company":"中国人民保险",
                    "days":"1y",
                    "people_count":"1",
                    "airplane_death":v[1],
                    "train_death":v[2],
                    "ship_disability":v[3],
                    "passenger_death":v[4],
                    "price":prices[num]
                }
                num+=1
                Helper.mergeTable( self.name,self.mysql,data )
